package dto

// LoginRequest 登录请求
type LoginRequest struct {
	Username    string `json:"username" binding:"required" example:"admin"`
	Password    string `json:"password" binding:"required" example:"Systemop@123"`
	CaptchaID   string `json:"captchaId" binding:"required"`
	CaptchaCode string `json:"captchaCode" binding:"required"`
}

// LoginResponse 登录响应
type LoginResponse struct {
	Token string `json:"token"`
}

// UserInfo 用户信息
type UserInfo struct {
	ID       uint     `json:"id"`
	Username string   `json:"username"`
	Nickname string   `json:"nickname"`
	Email    string   `json:"email"`
	Phone    string   `json:"phone"`
	Avatar   string   `json:"avatar"`
	Gender   int8     `json:"gender"`
	Status   int8     `json:"status"`
	Roles    []string `json:"roles"`
}

// MenuData 菜单数据
type MenuData struct {
	ID        uint        `json:"id"`
	ParentID  uint        `json:"parentId"`
	Type      int8        `json:"type"`
	Name      string      `json:"name"`
	Code      string      `json:"code"`
	Path      string      `json:"path"`
	Component string      `json:"component"`
	Icon      string      `json:"icon"`
	Sort      int         `json:"sort"`
	IsHidden  bool        `json:"isHidden"`
	Children  []*MenuData `json:"children,omitempty"`
}

// UserQueryParams 用户查询参数
type UserQueryParams struct {
	Page     int    `form:"page" binding:"required,min=1"`
	PageSize int    `form:"pageSize" binding:"required,min=1,max=100"`
	Username string `form:"username"`
	Nickname string `form:"nickname"`
	Email    string `form:"email"`
	Phone    string `form:"phone"`
	Status   *int8  `form:"status"`
	OrgID    *uint  `form:"orgId"`
}

// UserCreateRequest 创建用户请求
type UserCreateRequest struct {
	Username string `json:"username" binding:"required,min=3,max=50"`
	Password string `json:"password" binding:"required,min=6,max=20"`
	Nickname string `json:"nickname" binding:"required,min=2,max=50"`
	Email    string `json:"email" binding:"omitempty,email"`
	Phone    string `json:"phone" binding:"omitempty,len=11"`
	Avatar   string `json:"avatar"`
	Gender   int8   `json:"gender" binding:"omitempty,oneof=0 1 2"`
	Status   int8   `json:"status" binding:"omitempty,oneof=0 1"`
	Remark   string `json:"remark"`
	RoleIDs  []uint `json:"roleIds"`
	OrgID    uint   `json:"orgId"`
}

// UserUpdateRequest 更新用户请求
type UserUpdateRequest struct {
	Nickname string `json:"nickname" binding:"omitempty,min=2,max=50"`
	Email    string `json:"email" binding:"omitempty,email"`
	Phone    string `json:"phone" binding:"omitempty,len=11"`
	Avatar   string `json:"avatar"`
	Gender   int8   `json:"gender" binding:"omitempty,oneof=0 1 2"`
	Status   int8   `json:"status" binding:"omitempty,oneof=0 1"`
	Remark   string `json:"remark"`
	RoleIDs  []uint `json:"roleIds"`
	OrgID    *uint  `json:"orgId"`
}

// ChangePasswordRequest 修改密码请求
type ChangePasswordRequest struct {
	OldPassword string `json:"oldPassword" binding:"required,min=6"`
	NewPassword string `json:"newPassword" binding:"required,min=6,max=20"`
}

// AssignUserPermissionRequest 分配用户权限请求
type AssignUserPermissionRequest struct {
	PermissionIds []uint `json:"permissionIds" binding:"required"`
}
